package train48days;
import java.util.*;

public class 单词倒排 {
    public static boolean isAlpha(char ch){
        return ('a'<= ch&& ch<='z')||('A'<=ch && ch<='Z');
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            String s= sc.nextLine();
            char[] arr = s.toCharArray();
            for (int i = 0; i < arr.length; i++) {
                if (!isAlpha(arr[i])){
                    arr[i] = ' ';
                }
            }
             String str = new String(arr);
            String[] strArr=str.split(" ");
            StringBuilder sb = new StringBuilder();
            for (int i = strArr.length-1; i >=0 ; i--) {
                sb.append(strArr[i]+ " ");
            }
            System.out.println(sb.toString().trim());
    }

//    public static void main(String[] args)
//    {
//        Scanner sc = new Scanner(System.in);
//        String[] sp = sc.nextLine().split("[^a-zA-Z]");
//        StringBuilder sb = new StringBuilder();
//        for (int i = sp.length - 1; i >= 0; i--)
//            sb.append(sp[i] + " ");
//        System.out.println(sb.toString().trim());
//        sc.close();
    }
}
